<template>
  <div>
    <detail-banner :sightName="sightName" :bannerImg="bannerImg" :galleryImgs="galleryImgs"></detail-banner>
    <detail-header></detail-header>
    <detail-list :list='list'></detail-list>
  </div>
</template>

<script>
import axios from 'axios'
import detailBanner from './components/Banner.vue'
import detailHeader from './components/Header'
import detailList from './components/List'
export default {
  name: 'Detail',
  components: {
    detailBanner,
    detailHeader,
    detailList
  },
  data () {
    return {
      sightName: '',
      bannerImg: '',
      galleryImgs: [],
      list: [
      ]
    }
  },
  methods: {
    getDetailInfo () {
      axios.get('/api/detail.json', {
        params: {
          id: this.$route.params.id
        }
      })
        .then(this.handleGetDetailInfoSucc)
    },
    handleGetDetailInfoSucc (res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        this.sightName = data.sightName
        console.log(data.sightName)
        this.bannerImg = data.bannerImg
        console.log(data.bannerImg)
        this.galleryImgs = data.galleryImgs
        console.log(data.galleryImgs)
        this.list = data.categoryList
        console.log(data.categoryList)
      }
    }
  },
  mounted () {
    this.getDetailInfo()
  }
  // 防止缓存
  // activated () {
  //   this.getDetailInfo()
  // }
}
</script>

<style lang="stylus" scoped>

</style>
